<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数组的解构</title>
  </head>

  <body>

  </body>
  <script>
    /* 
    数组解构
    */
    var arr = [1, 2, 3, 4, 5];

    //1.完全解构
    /*  let [
       a,
       b,
       c,
       d,
       e,
       f
     ] = arr;
     console.log(a); //1
     console.log(b); //2
     console.log(c); //3
     console.log(d); //4
     console.log(e); //5
     console.log(f); //undefined */

    //2.部分解构
    let [a, , , , e] = arr;
    console.log(a); //1
    console.log(e); //5

    // 3.复合解构
    let arr2 = [1, 2, [10, 20, 30]];
    let [j, k, [x, y, z]] = arr2;
    console.log(j); //1
    console.log(k); //2
    console.log(x); //10
    console.log(y); //20
    console.log(z); //30
  </script>

</html>